import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useCommonStore = defineStore('common', () => {
  const theme = ref('dark')

  const toggleTheme = themeParams => {
    if (themeParams) {
      theme.value = themeParams
      return
    }

    if (theme.value === 'dark') {
      theme.value = 'light'
      return
    }

    theme.value = 'dark'
  }

  return { theme, toggleTheme }
})
